#include"ordinator.hpp"


int main()
{
    buttonrpc server;
    server.as_server(5555);

    vector<string> filenames = {
        "pg-being_ernest.txt",
        "pg-dorian_gray.txt",
        "pg-frankenstein.txt",
        "pg-grimm.txt",
        "pg-huckleberry_finn.txt",
        "pg-metamorphosis.txt",
        "pg-sherlock_holmes.txt",
        "pg-tom_sawyer.txt"
    };

    Coordinator master(filenames, 3);
    server.bind("AssignTask", &Coordinator::AssignTask, &master);
    server.bind("TaskFin", &Coordinator::TaskFin, &master);
    server.run();

    while (1)
    {
        if (master.Done()) break;
        sleep(3);
    }
    
    return 0;
}


